<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../header.inc"%>
    <title>录入住院信息</title>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
		/* 隐藏部分 */
		.as{
			display: none;
		}
    </style>
    <script type="text/javascript">
    $(function () {       
		$('#backid').click(function(){
			window.history.back(-1);
		 });
		
		$("#query").click(function(){
			
			$("#msg").html("");
			
			var rno = $("#rno").val();
			if(null  == rno || "" == rno ){
				$("#msg").html("病历号不能为空");
				return false;
			}
			//ajax请求后台
			$.ajax({
				url:"../hos",
				data:{"mark":"findRegisterInfo","rno":rno},
				type:"post",
				dataType:"json",
				success:function(obj){
					if(obj == false){
						$("#msg").html("病历号不存在或者已经办理住院");
					}else{
						//接收并返回信息
						$("#rno_new").val(obj.rno);
						$("#name").html(obj.name);
						$("#id_card").html(obj.id_card);
						$("#si_number").html(obj.si_number);
						$("#phone").html(obj.phone);
						$("#is_pay").html(obj.is_pay==0?'是':'否');
						$("#sex").html(obj.sex==0?'男':'女');
						$("#age").html(obj.age);
						$("#consultation").html(obj.consultation==0?'初诊':'复诊');
						
						//科室 
						if(obj.department == 0){$("#department").html("急诊科");}
						if(obj.department == 1){$("#department").html("儿科");}
						if(obj.department == 2){$("#department").html("妇科");}
						if(obj.department == 3){$("#department").html("皮肤科");}
						if(obj.department == 4){$("#department").html("内分泌科");}
						if(obj.department == 5){$("#department").html("牙科");}
						
						$("#doctor").html(obj.doctor.name);
						$("#remark").html(obj.remark);
						
					}
				}
			});
		});
		
		//显示隐藏操作
		$("#showAndHide").click(function(){
			$(".as").fadeToggle(500);
		});
		
    });
    </script>
</head>
<body>
<form action="../hos" method="post" class="definewidth m20">
	
<input name="mark" value="saveHospitalization" type="hidden">
<input id="rno_new" name="rno" value="" type="hidden">

<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">病历号</td>
        <td>
        	<input type="text" id="rno"  placeholder="输入病历号查询挂号人信息"/>
        	<button type="button" class="btn btn-success" id="query"  >精准查询</button>
        	<span id="msg" style="color: red"></span>
        </td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">姓名</td>
        <td id="name"></td>
    </tr>
    <tr>
        <td width="10%" class="" colspan="2">
        	<a href="javascript:void(0)" id="showAndHide">显示全部信息</a>
        </td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">证件号</td>
        <td id="id_card"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">社保号</td>
        <td id="si_number"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">联系电话</td>
        <td id="phone"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">是否自费</td>
        <td id="is_pay"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">性别</td>
        <td id="sex"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">年龄</td>
        <td id="age"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">初复诊</td>
        <td id="consultation"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">所挂科室</td>
        <td id="department"></td>
    </tr>
    <tr class="as">
        <td width="10%" class="tableleft">指定医生</td>
        <td id="doctor"></td>
    </tr>
	<tr class="as">
        <td width="10%" class="tableleft">备注</td>
        <td id="remark"></td>
	</tr>
    <tr>
        <td width="10%" class="tableleft">床位号</td>
        <td><input type="text" name="bed_no" value=""/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">缴费押金</td>
        <td><input type="text" name="deposit" value=""/></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">病情</td>
        <td><textarea name="description"></textarea></td>
    </tr>
    <tr>
        <td colspan="2">
			<center>
				<button type="submit" class="btn btn-primary">保存</button> &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
			</center>
		</td>
    </tr>
</table>
</form>
</body>
</html>